package com.example.controller;

import com.example.dto.CategoryQueryVO;
import com.example.entity.CategoryInfo;
import com.example.entity.ResBody;
import com.example.service.CategoryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/master/api/product/category/tree")
public class CategoryController {

    @Resource
    private CategoryService categoryService;

    @PostMapping("/v1")
    public ResBody<List<CategoryInfo>> list(@RequestBody CategoryQueryVO vo) {
        return ResBody.success(categoryService.listByQuery(vo));
    }
}
